<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8" import="entity.Dept,java.util.*"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<meta name="renderer" content="webkit|ie-comp|ie-stand">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
<link rel="Bookmark" href="/favicon.ico" >
<link rel="Shortcut Icon" href="/favicon.ico" />

<link rel="stylesheet" type="text/css" href="static/h-ui/css/H-ui.min.css" />
<link rel="stylesheet" type="text/css" href="static/h-ui.admin/css/H-ui.admin.css" />
<link rel="stylesheet" type="text/css" href="lib/Hui-iconfont/1.0.8/iconfont.css" />
<link rel="stylesheet" type="text/css" href="static/h-ui.admin/skin/default/skin.css" id="skin" />
<link rel="stylesheet" type="text/css" href="static/h-ui.admin/css/style.css" />

<title>部门管理列表</title>
</head>

<body>
<nav class="breadcrumb"><i class="Hui-iconfont">&#xe67f;</i> 首页 <span class="c-gray en">&gt;</span> 薪资管理 <span class="c-gray en">&gt;</span>查看员工薪资<a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px" href="EmployeeSalaryListServlet" title="刷新" ><i class="Hui-iconfont">&#xe68f;</i></a></nav>
<div class="page-container" style="margin-left:35%">
     <form action="SearchEmployeeSalaryServlet" method="post">
		<input type="text" class="input-text" style="width:250px" placeholder="输入员工ID" id="" name="empId">
		<button type="submit" class="btn btn-success" id="" name=""><i class="Hui-iconfont">&#xe665;</i>搜索</button>
     </form>
</div>
	<div class="cl pd-5 bg-1 bk-gray mt-20"> 
	<span class="l"> <a href="javascript:;" onclick="salary_add('添加员工工资','a_salary/addSalary.jsp','800','500')" class="btn btn-primary radius"><i class="Hui-iconfont">&#xe600;</i> 添加员工工资</a></span>
	<span class="l"><input type="button" value="批量删除" style="width:100px;margin-left:800px;height:34px; border-radius:5px;background-color:red;color:white;"/></span> 
	</div>
	
<div id="content" style="backgraoud-color:white;color:black;" >

</div>
	<table class="table table-border table-bordered table-bg" id="test_table">
		<thead>
			<tr>
				<th scope="col" colspan="12">员工工资列表</th>
			</tr>
			<tr class="text-c">
				<th width="25">
				<th width="40">ID</th>
				<th width="90">员工ID</th>
				<th width="90">岗位工资</th>
				<th width="90">薪级工资</th>
				<th width="90">职务工资</th>
				<th width="90">绩效工资</th>
				<th width="90">惩罚扣薪</th>
				<th width="90">应发工资</th>
				<th width="90">个人所得税</th>
				<th width="90">实发工资</th>
				<th width="90">操作</th>
			</tr>
		</thead>
		<tbody>
		<c:forEach items="${salary }" var="s">
			<tr class="text-c">
				<td><input type="checkbox" value="${s.id }" name="check"></td>
				<td>${s.id }</td>
				<td>${s.empId }</td>
				<td>${s.positionSal }</td>
				<td>${s.xinjiSal }</td>
				<td>${s.zhiwuSal }</td>
				<td>${s.jixiaoSal }</td>
				<td>${s.punishSal }</td>
				<td>${s.allSal }</td>
				<td>${s.privateDuty }</td>
				<td>${s.factSal }</td>
				<td class="td-manage">
				<input type="button" onclick="salary_del(${s.id })" value="删除" />
				<input type="button" onclick="detailSalary_edit(${s.empId })" value="详情工资" />
				</td>
			</tr>
			</c:forEach>
		</tbody>
	</table>
	

<script type="text/javascript" src="static/h-ui.admin/js/H-ui.admin.js"></script>
<!-- 搜索操作 -->
<script type="text/javascript" src="js/search.js"></script>
<!--_footer 作为公共模版分离出去-->
<script type="text/javascript" src="lib/jquery/1.9.1/jquery.min.js"></script> 
<script type="text/javascript" src="lib/layer/2.4/layer.js"></script>
<script type="text/javascript" src="static/h-ui/js/H-ui.min.js"></script>  <!--/_footer 作为公共模版分离出去-->

<!--请在下方写此页面业务相关的脚本-->
<script type="text/javascript" src="lib/My97DatePicker/4.8/WdatePicker.js"></script> 
<script type="text/javascript" src="lib/datatables/1.10.15/jquery.dataTables.min.js"></script> 
<script type="text/javascript" src="lib/laypage/1.2/laypage.js"></script>
<script type="text/javascript">
//选中批量删除
$(function(){  
    $("input[type='button']").click(function() {
        $("input[name='check']:checked").each(function() { // 遍历选中的checkbox
            n = $(this).parents("tr").index()+2;  // 获取checkbox所在行的顺序
            $("table#test_table").find("tr:eq("+n+")").remove();
        });
    });
});

//添加
function salary_add(title,url,w,h){
	layer_show(title,url,w,h);
}

//修改详细薪水
function detailSalary_edit(id){
	location.href="RecordDetailSalaryServlet?id="+id;
}
//删除
function salary_del(id){
	layer.confirm('确认要删除吗？',function(index){
		$.ajax(
				{
					url:'DelSalaryServlet',
					async : false,
		            cache : false,
		            traditional: true,
		            type : 'POST',
					data:{
						id : id
					},
					success:function(result){
						layer.closeAll();
						layer.msg('已删除!',{icon: 5,time:1000});
						window.location.reload();刷新父级页面
						var index = layer.getFrameIndex(window.name); //获取当前页面索引
						layer.close(index); //关闭当前页面
					},
					error:function(result){
						layer.closeAll();
						//layer.msg(result.msg);
					}
				});	
	});
}
</script>
</body>
</html>